<div class="row">
	<div class="box col-md-12">
		<div class="box-inner">
			<div class="box-header well">
				<h2><i class="glyphicon glyphicon-user"></i> Danh sách sản phẩm</h2>
				<div class="box-icon">
					<a href="#" class="btn btn-minimize btn-round btn-default"><i class="glyphicon glyphicon-chevron-up"></i></a>
					<a href="#" class="btn btn-close btn-round btn-default"><i class="glyphicon glyphicon-remove"></i></a>
				</div>
			</div>
			<div class="box-content"><?php
			echo form_open(null,array(
				'class'=>'form-horizontal','role'=>'form'
			));
				?><div class="form-group">
					<label class="col-sm-3 col-md-3 col-lg-2 control-label">Tên sản phẩm:</label>
					<div class="col-sm-3 col-md-3"><?php
						echo form_input(array(
							'name'=>'ten','value'=>set_value('ten'),
							'class'=>'form-control','required'=>'required',
							'placeholder'=>'Tiêu đề sản phẩm'
						));
						echo form_error('ten');
					?></div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 col-md-3 col-lg-2 control-label">Chủng loại:</label>
					<div class="col-sm-3 col-md-3"><?php
						$val = array();
						foreach($cat as $v)
							$val[$v->getId()] = $v->getName();

						echo form_dropdown('chung-loai', $val, set_value('chung-loai'), 'class="form-control"');
						echo form_error('chung-loai');
					?></div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 col-md-3 col-lg-2 control-label">Hình đại diện:</label>
					<div class="col-sm-3 col-md-3">
						<span class="thumbnail">
						</span><?php
						echo form_input(array(
							'name'=>'thumb','value'=>set_value('thumb'),
							'class'=>'form-control','required'=>'required',
							'placeholder'=>'Hình đại diện'
						));
						echo form_error('thumb');
					?></div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 col-md-3 col-lg-2 control-label">Màu sắc:</label>
					<div class="col-sm-3 col-md-3"><?php
						$color = $this->input->post('color');
						foreach($list_color as $v):
							echo '<label class="form-label" data-toggle="tooltip" data-placement="top" title="Màu '.html_escape($v->getName()).'" style="margin-right:5px">';
							if(!empty($color) && in_array($v->getId(), $color))
								$check = 'checked="checked"';
							else
								$check = null;
							echo '<input type="checkbox" name="color[]" value="'.$v->getId().'" '.$check.'><span class="product-color" style="background: #'
								.html_escape($v->getVal()).'; padding: 5px 20px"></span>';
							echo '</label>';
						endforeach;
					?></div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 col-md-3 col-lg-2 control-label">Kích thước:</label>
					<div class="col-sm-3 col-md-3"><?php
						$size = $this->input->post('size');
						foreach($list_size as $v):
							echo '<label class="form-label" data-toggle="tooltip" data-placement="top" title="Màu '.html_escape($v->getName()).'" style="margin-right:5px">';
							if(!empty($size) && in_array($v->getId(), $size))
								$check = 'checked="checked"';
							else
								$check = null;
							echo '<input type="checkbox" name="size[]" value="'.$v->getId().'" '.$check.'><span class="product-size">'.
								$v->getVal().'</span>';
							echo '</label>';
						endforeach;
					?></div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 col-md-3 col-lg-2 control-label">Đơn giá:</label>
					<div class="col-sm-3 col-md-3"><?php
						echo form_input(array(

							'class'=>'form-control','required'=>'required',
							'placeholder'=>'Tiêu đề sản phẩm'
						));
						echo form_error('gia');
					?></div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 col-md-3 col-lg-2 control-label">Số lượng:</label>
					<div class="col-sm-3 col-md-3"><?php
						echo form_input(array(
							'name'=>'so-luong','value'=>set_value('so-luong', 1),
							'class'=>'form-control','required'=>'required',
							'placeholder'=>'Tiêu đề sản phẩm'
						));
						echo form_error('so-luong');
					?></div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 col-md-3 col-lg-2 control-label">Chi tiết:</label>
					<div class="col-sm-3 col-md-3"><?php
						echo form_textarea(array(

							'name'=>'chi-tiet','value'=>set_value('chi-tiet'),
							'class'=>'form-control',
							'placeholder'=>'Thông tin chi tiết'
						));
						echo form_error('chi-tiet');
					?></div>	
				</div>
				<div class="form-group">
					<div class="col-sm-3 col-md-3 col-sm-push-2"><?php
						echo form_submit(array(

							'class'=>'btn btn-success'
						)).' '.form_reset(array(
							'name'=>'reset','value'=>'Nhập lại',
							'class'=>'btn btn-warning'
						));
					?></div>
				</div>
				<?php
			echo form_close();
			?></div>
		</div>
	</div>
</div>
<div class="modal fade" id="gallery_selector" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">Hình ảnh</h4>
      </div>
      <div class="modal-body">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
        <button type="button" class="btn btn-primary" id="gallery_submit">Chọn hình</button>
      </div>
    </div>
  </div>
</div>
<script>
$('.product-color').click(function(){
	console.log('asd');
});
</script>